<?php
if (!isset($ajax) || !$ajax) {
  $srcFolder = $_SERVER['DOCUMENT_ROOT']."/rspinf-usb/perfil/src/";
  $classes = array("bd/DataBase.php",
                   "fachadasBD/FachadaBDPerfil.php"
                   );
  foreach ($classes as $class)
    require_once($srcFolder.$class);
}
DataBase::getInstance();
$fachadaBD = FachadaBDPerfil::getInstance();
$usrname = $_GET["image"];
$row = $fachadaBD->getImagen($usrname);
$imagebytes = $row["foto"];
header("Content-length: ".$row["tamFoto"]);
header("Content-type: ".$row["formatoFoto"]);
header("filename=".$row["nombreFoto"].";");
//print $imagebytes;
echo $imagebytes;
?>